"""
百度输入框搜索selenium
查看有没有selenium自动化测试这几个字符
"""

from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

url = 'https://www.baidu.com/'
driver = webdriver.Chrome()
driver.get(url)
driver.maximize_window()

# 获取到输入框并点击搜索
ipt = driver.find_element(By.ID, 'kw')
ipt.send_keys('selenium')
driver.find_element(By.ID, 'su').click()
sleep(5)

# title_1s7eZ
titles = driver.find_element(By.ID, 'content_left')
h3 = titles.find_elements(By.TAG_NAME, 'h3')
for i in h3:
    if 'Selenium 简介' in i.text:  # 正则表达式没弄明白先这样吧
        print(f'找到了在这儿{i.text}')
        break
else:
    print('没找到！！')